<template>
  <a-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <div>
          <a-collapse v-model="activeKey">
            <a-collapse-panel header="日志信息" key="1">
              <a-row class="form-row" :gutter="24">
                <a-col :lg="6">
                  <a-form-item label="创建人" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'createBy', validatorRules.createBy]"  :readOnly="true" placeholder=" 自动创建"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="创建日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <j-date placeholder=" 自动创建" v-decorator="[ 'createTime', validatorRules.createTime]"  :readOnly="true":trigger-change="true" style="width: 100%"/>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="更新人" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'updateBy', validatorRules.updateBy]" :readOnly="true" placeholder=" 自动创建"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="更新日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <j-date placeholder=" 自动创建" v-decorator="[ 'updateTime', validatorRules.updateTime]" :trigger-change="true" :readOnly="true" style="width: 100%"/>
                  </a-form-item>
                </a-col>
              </a-row>
            </a-collapse-panel>
            <a-collapse-panel header="组织信息" key="2" :disabled='false'>
              <a-row class="form-row" :gutter="24">
                <a-col :lg="6">
                  <a-form-item label="所属部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'sysOrgCode', validatorRules.sysOrgCode]" :readOnly="true" placeholder=" 自动创建"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="租户ID" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query01', validatorRules.query01]" placeholder="请输入租户ID"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="是否有效" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query02', validatorRules.query02]" placeholder="请输入是否有效"></a-input>
                  </a-form-item>
                </a-col>
              </a-row>
            </a-collapse-panel>
            <a-collapse-panel header="流程信息" key="3" :disabled='false'>
              <a-row class="form-row" :gutter="24">
                <a-col :lg="6">
                  <a-form-item label="流程类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query03', validatorRules.query03]" placeholder="请输入流程类型"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="流程名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query04', validatorRules.query04]" placeholder="请输入流程名称"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="流程备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query06', validatorRules.query06]" placeholder="请输入流程备注"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="流程步骤" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query05', validatorRules.query05]" placeholder="请输入流程步骤"></a-input>
                  </a-form-item>
                </a-col>
              </a-row>
            </a-collapse-panel>
            <a-collapse-panel header="订单信息" key="4" :disabled='false'>
              <a-row class="form-row" :gutter="24">
                <a-col :lg="6">
                  <a-form-item label="订单编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query07', validatorRules.query07]" placeholder="请输入订单编号"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="合同编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query08', validatorRules.query08]" placeholder="请输入合同编号"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="合同名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query09', validatorRules.query09]" placeholder="请输入合同名称"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :lg="6">
                  <a-form-item label="提交公证" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <j-dict-select-tag type="list" v-decorator="['query39', validatorRules.query39]" :trigger-change="true" dictCode="fxy_yn" placeholder="请选择提交公证"/>
                  </a-form-item>
                  <!-- <a-form-item label="提交公证" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input v-decorator="[ 'query39', validatorRules.query39]"  placeholder="请输入提交公证"></a-input>
                  </a-form-item> -->
                </a-col>
              </a-row>
            </a-collapse-panel>
          </a-collapse>
        </div>
        <!--<a-form-item label="备用2" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query11', validatorRules.query11]" placeholder="请输入备用2"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用3" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query12', validatorRules.query12]" placeholder="请输入备用3"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用4" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query13', validatorRules.query13]" placeholder="请输入备用4"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用5" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query14', validatorRules.query14]" placeholder="请输入备用5"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用6" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query15', validatorRules.query15]" placeholder="请输入备用6"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用7" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query16', validatorRules.query16]" placeholder="请输入备用7"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用8" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query17', validatorRules.query17]" placeholder="请输入备用8"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用9" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query18', validatorRules.query18]" placeholder="请输入备用9"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用10" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query19', validatorRules.query19]" placeholder="请输入备用10"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用11" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query20', validatorRules.query20]" placeholder="请输入备用11"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用12" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query21', validatorRules.query21]" placeholder="请输入备用12"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用13" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query22', validatorRules.query22]" placeholder="请输入备用13"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用14" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query23', validatorRules.query23]" placeholder="请输入备用14"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用15" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query24', validatorRules.query24]" placeholder="请输入备用15"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用16" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query25', validatorRules.query25]" placeholder="请输入备用16"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用17" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query26', validatorRules.query26]" placeholder="请输入备用17"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用18" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query27', validatorRules.query27]" placeholder="请输入备用18"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用19" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query28', validatorRules.query28]" placeholder="请输入备用19"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用20" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query29', validatorRules.query29]" placeholder="请输入备用20"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用21" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query30', validatorRules.query30]" placeholder="请输入备用21"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用22" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query31', validatorRules.query31]" placeholder="请输入备用22"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用23" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query32', validatorRules.query32]" placeholder="请输入备用23"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用24" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query33', validatorRules.query33]" placeholder="请输入备用24"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用25" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query34', validatorRules.query34]" placeholder="请输入备用25"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用26" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query35', validatorRules.query35]" placeholder="请输入备用26"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用27" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query36', validatorRules.query36]" placeholder="请输入备用27"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用28" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query37', validatorRules.query37]" placeholder="请输入备用28"></a-input>-->
        <!--</a-form-item>-->
        <!--<a-form-item label="备用29" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
          <!--<a-input v-decorator="[ 'query38', validatorRules.query38]" placeholder="请输入备用29"></a-input>-->
        <!--</a-form-item>-->
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
  import { httpAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import { validateDuplicateValue } from '@/utils/util'
  import JDate from '@/components/jeecg/JDate'  

  export default {
    name: "FxyGzgl01Modal",
    components: { 
      JDate,
    },
    data () {
      return {
        form: this.$form.createForm(this),
        title:"操作",
        width:1400,
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
          createBy: {rules: [
          ]},
          createTime: {rules: [
          ]},
          updateBy: {rules: [
          ]},
          updateTime: {rules: [
          ]},
          sysOrgCode: {rules: [
          ]},
          query01: {rules: [
          ]},
          query02: {rules: [
          ]},
          query03: {rules: [
          ]},
          query04: {rules: [
          ]},
          query05: {rules: [
          ]},
          query06: {rules: [
          ]},
          query07: {rules: [
          ]},
          query08: {rules: [
          ]},
          query09: {rules: [
          ]},
          query10: {rules: [
          ]},
          query11: {rules: [
          ]},
          query12: {rules: [
          ]},
          query13: {rules: [
          ]},
          query14: {rules: [
          ]},
          query15: {rules: [
          ]},
          query16: {rules: [
          ]},
          query17: {rules: [
          ]},
          query18: {rules: [
          ]},
          query19: {rules: [
          ]},
          query20: {rules: [
          ]},
          query21: {rules: [
          ]},
          query22: {rules: [
          ]},
          query23: {rules: [
          ]},
          query24: {rules: [
          ]},
          query25: {rules: [
          ]},
          query26: {rules: [
          ]},
          query27: {rules: [
          ]},
          query28: {rules: [
          ]},
          query29: {rules: [
          ]},
          query30: {rules: [
          ]},
          query31: {rules: [
          ]},
          query32: {rules: [
          ]},
          query33: {rules: [
          ]},
          query34: {rules: [
          ]},
          query35: {rules: [
          ]},
          query36: {rules: [
          ]},
          query37: {rules: [
          ]},
          query38: {rules: [
          ]},
          query39: {rules: [
          ]},
        },
        url: {
          add: "/gzgl/fxyGzgl01/add",
          edit: "/gzgl/fxyGzgl01/edit",
        },
        activeKey: ['4']

    }
    },
    created () {
    },
    methods: {
      add () {
        this.edit({});
      },
      edit (record) {
        this.form.resetFields();
        this.model = Object.assign({}, record);
        this.visible = true;
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,'createBy','createTime','updateBy','updateTime','sysOrgCode','query01','query02','query03','query04','query05','query06','query07','query08','query09','query10','query11','query12','query13','query14','query15','query16','query17','query18','query19','query20','query21','query22','query23','query24','query25','query26','query27','query28','query29','query30','query31','query32','query33','query34','query35','query36','query37','query38','query39'))
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        const that = this;
        // 触发表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            let formData = Object.assign(this.model, values);
            console.log("表单提交数据",formData)
            httpAction(httpurl,formData,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })
          }
         
        })
      },
      handleCancel () {
        this.close()
      },
      popupCallback(row){
        this.form.setFieldsValue(pick(row,'createBy','createTime','updateBy','updateTime','sysOrgCode','query01','query02','query03','query04','query05','query06','query07','query08','query09','query10','query11','query12','query13','query14','query15','query16','query17','query18','query19','query20','query21','query22','query23','query24','query25','query26','query27','query28','query29','query30','query31','query32','query33','query34','query35','query36','query37','query38','query39'))
      },

      
    }
  }
</script>